Loops are fundamental programming constructs that instruct a computing device to repeat a section of code a certain number of times. Loops expressed in high-level languages are typically compiled into a sequence of binary instructions including one or more jumps to a previously-executed instruction, which may be known as “binary loops.”
Detection of binary loops in a section of code may be used for performance analysis and optimization purposes, and for developing new computer architectures. In particular, binary loop detection and analysis may be used to improve parallelization or vectorization of loops, or for load balancing. One measure of loop performance is trip count, which is a measure of the average number of iterations for each invocation of a binary loop. Binary loop detection is also performed by dynamic compilers such as just-in-time compilers used to execute bytecode. Binary loop detection is typically performed by applying heavy profiling to a binary. Typical binary loop detection techniques are also limited to single-threaded applications.